package sa.com.sure.ejtimaa;


import java.text.ParseException;

import sa.com.sure.ejtimaa.common.Helper;
import sa.com.sure.ejtimaa.components.MeetingAttachmentsListComponent;
import sa.com.sure.ejtimaa.components.MeetingDetailComponent;
import sa.com.sure.ejtimaa.components.MeetingItemsListComponent;
import sa.com.sure.ejtimaa.model.MeetingInfo;
import android.app.Fragment;
import android.database.SQLException;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;


public class MeetingDetailFragment extends Fragment {

	private MeetingDetailComponent meetingDetailComponent  = null;
	private MeetingItemsListComponent meetingItemsListComponent = null;
	private MeetingAttachmentsListComponent meetingAttachmentsListComponent = null;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
	}
	
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);

	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.meeting_detail, container, false);
		return view;
	}
	
    @Override
	public void onStart(){
    	
    	try
	    {
    		super.onStart();	    		
    		meetingDetailComponent  =(MeetingDetailComponent) getView().findViewById(R.id.meetingDetailComponent);
    		meetingItemsListComponent  =(MeetingItemsListComponent) getView().findViewById(R.id.meetingItemsListComponent);
    		meetingAttachmentsListComponent  =(MeetingAttachmentsListComponent) getView().findViewById(R.id.meetingAttachmentsListComponent);
		}
		catch(Exception ex){    		
	    	Helper.HandleError(ex,true);
		}  
    }
	
	public void SetData(MeetingInfo item) throws SQLException, ParseException{
		
		meetingDetailComponent.SetData(item);
		meetingItemsListComponent.SetData(item);
		meetingAttachmentsListComponent.SetData(item);
	}
}
